<template>
    <div>
        <headerVue ref="heads" @reds="get"></headerVue>
        <van-cell-group>
            <van-cell v-for="o in setpro" :key="o.id" :title="o.name" />
        </van-cell-group>
    </div>
</template>

<script>
import headerVue from "../other/header.vue"
export default {
    data() {
        return {
            value: "",
            setpro: []
        }
    },
    components: {
        headerVue
    }, methods: {
        async getpro(i) {
            console.log(i);
            let res = await this.$post(this.url + "catalog/search/product", {
                productName: this.value,
                pageSize: 10,
                currentPage: this.index,
            });
            if (res.errorCode == "0") {
                // this.setpro = res.data.productList;
                this.setpro = res.data.productList
                console.log(this.setpro);
                // this.total = res.data.totalPage;
            }
        },
        async get(i) {
            console.log(i);
            let res = await this.$post(this.url + "catalog/search/product", {
                productName: i,
                pageSize: 10,
                currentPage: this.index,
            });
            if (res.errorCode == "0") {
                // this.setpro = res.data.productList;
                this.setpro = res.data.productList
                console.log(this.setpro);
                // this.total = res.data.totalPage;
            }
        },

    },
    created() {
        this.value = this.Sto.Session.get("search")
        this.getpro()

    },
    mounted() {
        this.$refs.heads.isbools = true
    },
}
</script>

<style  scoped>
</style>